<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/include/taglib.jsp"%>
<%@ page import="java.sql.*"%>
<%//连接数据库
String driverName = "com.mysql.jdbc.Driver"; //Mysql数据库连接
String userName = "root";
String psw = "123456"; //本行和上一行是数据库的登录名和密码
String dbName = "test1"; //数据库名字
String url = "jdbc:mysql://localhost:3306/test1?serverTimezone=UTC";
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(url, userName, psw);					
Statement stmt = conn.createStatement(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css">
<script>
	var ctx = "${ctx}";
</script>
<style type="text/css">
      .layui-input,.layui-select { width: 250px ; }
</style>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#div1").fadeIn();
    $("#div2").fadeIn("slow");
    $("#div3").fadeIn(3000);
  });
});
</script>

</head>
<body>
	<form class="layui-form" style="width: 80%;" id="auf">
		<div class="layui-form-item">
			<label class="layui-form-label">商品名称</label>
			<div class="layui-input-inline">
				<!-- 	<input type="text" name="product_id" id="product_id" class="layui-input"
					lay-verify="required" placeholder="请输入产品名称" value=""> -->
				<!-- <select name="modules" lay-verify="required" lay-search=""> -->
				<select name="product_id" id="product_id"
					class="layui-input search_input" lay-verify="required"
					lay-search="">
					<option value="">--请选择要关联的商品--</option>
					<%
						
						ResultSet rs = stmt.executeQuery("SELECT product.product_name,product.product_id FROM product");

						while (rs.next()) //循环输出数据
						{
							out.print("<option value=" + rs.getInt("product_id") + ">" + rs.getString("product_name") + "</option>");
						}
					%>
					<!-- <option value="彩妆">彩妆</option>
						<option value="品牌箱包">品牌箱包</option>
						<option value="鞋履">鞋履</option>
						<option value="女士穿搭">女士穿搭</option>
						<option value="男士护肤">男士护肤</option>
						<option value="内衣">内衣</option>
						<option value="品质男装">品质男装</option>
						<option value="运动">运动</option>
						<option value="钟表配饰">钟表配饰</option>
						<option value="居家">居家</option>
						<option value="食品保健">食品保健</option>
						<option value="母婴">母婴</option>
						<option value="数码家电">数码家电</option>
						<option value="护肤">护肤</option> -->
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">产品分类</label>
			<div class="layui-input-inline">
				<!-- 	<input type="text" name="session_id" id="session_id"
					class="layui-input" lay-verify="required" placeholder="场次id"
					value=""> -->
				<select name="product_id" id="product_id"
					class="layui-input search_input" lay-verify="required"
					lay-search="">
					<option value="" >--请选择活动场次--</option>
					<%
					String driverName1 = "com.mysql.jdbc.Driver"; //Mysql数据库连接
					String userName1 = "root";
					String psw1 = "123456"; //本行和上一行是数据库的登录名和密码
					String dbName1 = "test1"; //数据库名字
					String url1 = "jdbc:mysql://localhost:3306/test1?serverTimezone=UTC";
					Class.forName("com.mysql.jdbc.Driver");
					Connection conn1 = DriverManager.getConnection(url1, userName1, psw1);
					String strSql1 = "SELECT activitysessions.session_name,activitysessions.session_id FROM activitysessions";
					Statement stmt1 = conn1.createStatement();
					ResultSet rs1 = stmt1.executeQuery(strSql1);
						while (rs1.next()) //循环输出数据
						{
							out.print("<option value=" + rs1.getInt("session_id") + ">" + rs1.getString("session_name") + "</option>");
						}
					%>
				</select>

			</div>
		</div>




		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="addActivity">立即提交</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="${ctx }/layui/layui.js"></script>
	<script type="text/javascript" src="${ctx }/js/activity/addActivity.js"></script>
</body>
</html>